package io;

import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class Test5 {
    public static void main(String[] args) throws FileNotFoundException {
        Scanner scan=new Scanner(System.in);


        FileOutputStream fos=new FileOutputStream("note.txt");
        OutputStreamWriter osw=new OutputStreamWriter(fos, StandardCharsets.UTF_8);
        BufferedWriter bw=new BufferedWriter(osw);
        PrintWriter pw=new PrintWriter(bw,true);

        System.out.println("请输入内容");

        while (true){
            String ling=scan.toString();
            if("exit".equalsIgnoreCase(ling)){
                break;
            }
            pw.println(ling);





        }
        System.out.println("再见!");
        pw.close();
    }
}
